package com.mairuide.phonebaseinfo.service;

import com.mairuide.phonebaseinfo.dao.BS_460Dao;
import com.mairuide.phonebaseinfo.dao.BS_CDMA_460Dao;
import com.mairuide.phonebaseinfo.pojo.BS_460;
import com.mairuide.phonebaseinfo.pojo.BS_CDMA_460;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by 敲代码的卡卡罗特
 * on 2018/12/19 11:48.
 */
@Service
public class PhoneInfoService {

    @Autowired
    private BS_CDMA_460Dao baseCDMAdao;
    @Autowired
    private BS_460Dao basedao;

    public Object getPhoneInfoById(String id){
        BS_CDMA_460 BS_CDMA_460 = baseCDMAdao.findOne(id);
        if (BS_CDMA_460!=null){
            return BS_CDMA_460;
        }else{
            BS_460 Optional_BS_460 = basedao.findOne(id);
            if (Optional_BS_460!=null){
                return Optional_BS_460;
            }
        }
        return null;
    }

    public List getPhoneInfoByIds(List<String> ids){
        List<BS_CDMA_460> list = baseCDMAdao.findByIdIn(ids);
        if (list.size()==0){
            List<BS_460> list2 = basedao.findByIdIn(ids);
            return list2;
        }
        return list;
    }
}
